{$CLEO .cs}
{$USE CLEO+}
{$USE newOpcodes}
{$USE ini}

0000: NOP

script_name "StartBP3"

// By ArtemQa146

wait 600

if
    0AA2: 31@ = load_dynamic_library "CLEO+.cleo"
then
    if
        0AA4: 30@ = get_dynamic_library_procedure "GetCleoPlusVersion" library 31@
    then
        0AA7: call_function_return 30@ num_params 0 pop 0 29@
        if
            not 29@ >= 0x1020000
        then
            0AD1: show_formatted_text_highpriority "Cleo+ 1.2.0 (or higher) version is required, the Busy Pedestrians mod is disabled" time 15000
            0AA3: free_dynamic_library 31@
            0A93: terminate_this_custom_script
        end
        0AA3: free_dynamic_library 31@
    end
else
    0AD1: show_formatted_text_highpriority "Cleo+ 1.2.0 (or higher) version is required, the Busy Pedestrians mod is disabled" time 15000
    0AA3: free_dynamic_library 31@
    0A93: terminate_this_custom_script
end

if
    0E2D: is_game_first_start
then
    0F00: load_special_model_dff "modelsq\cameravhs" txd "modelsq\OtherQa" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "cameravhs"
    0F00: load_special_model_dff "modelsq\microvhs" txd "modelsq\OtherQa" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "microvhs"
    0F00: load_special_model_dff "modelsq\sh_basket_1" txd "modelsq\OtherQa" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "sh_basket_1"
    0F00: load_special_model_dff "modelsq\sh_basket_2" txd "modelsq\OtherQa" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "sh_basket_2"
    0F00: load_special_model_dff "modelsq\sh_basket_3" txd "modelsq\OtherQa" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "sh_basket_3"
    0F00: load_special_model_dff "modelsq\rcpadq" txd "modelsq\OtherQa" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "rcpadq"
    0F00: load_special_model_dff "modelsq\frsaleq" txd "modelsq\OtherQa" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "frsaleq"
    0F00: load_special_model_dff "modelsq\hammerq" txd "modelsq\OtherQa" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "hammerq"
    0F00: load_special_model_dff "modelsq\tlscopeq" txd "modelsq\OtherQa" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "tlscopeq"
    0F00: load_special_model_dff "modelsq\ice" txd "modelsq\PedsVndQ" store_to 0@
    0AF1: write_int 0@ to_ini_file "cleo\PedsModels.ini" section "Models" key "iceq"
end


timera = 0
timerb = 0

const
    chance_video_news = 31@
    render_camvhs = 30@
    render_microvhs = 29@
    chance_arm = 28@
    chance_pool = 27@
    pos_x = 26@
    pos_y = 25@
    pos_z = 24@
    chance_boom = 23@
    render_rc = 22@
    chance_rc = 21@
    render_fors = 20@
    render_hammer = 19@
    render_telscop = 18@
    render_ice = 17@
    chance_dice = 16@
    pause = 400
end

0AF0: render_camvhs = read_int_from_ini_file "cleo\PedsModels.ini" section "Models" key "cameravhs"
0AF0: render_microvhs = read_int_from_ini_file "cleo\PedsModels.ini" section "Models" key "microvhs"
0AF0: render_rc = read_int_from_ini_file "cleo\PedsModels.ini" section "Models" key "rcpadq"
0AF0: render_fors = read_int_from_ini_file "cleo\PedsModels.ini" section "Models" key "frsaleq"
0AF0: render_hammer = read_int_from_ini_file "cleo\PedsModels.ini" section "Models" key "hammerq"
0AF0: render_telscop = read_int_from_ini_file "cleo\PedsModels.ini" section "Models" key "tlscopeq"
0AF0: render_ice = read_int_from_ini_file "cleo\PedsModels.ini" section "Models" key "iceq"

0AF0: chance_video_news = read_int_from_ini_file "cleo\Busy Pedestrians.ini" section "Percent Chance" key "Video News"
0AF0: chance_arm = read_int_from_ini_file "cleo\Busy Pedestrians.ini" section "Percent Chance" key "Arm wrestling"
0AF0: chance_pool = read_int_from_ini_file "cleo\Busy Pedestrians.ini" section "Percent Chance" key "People in the pool"
0AF0: chance_boom = read_int_from_ini_file "cleo\Busy Pedestrians.ini" section "Percent Chance" key "Boombox"
0AF0: chance_rc = read_int_from_ini_file "cleo\Busy Pedestrians.ini" section "Percent Chance" key "Rc Car Players"
0AF0: chance_dice = read_int_from_ini_file "cleo\Busy Pedestrians.ini" section "Percent Chance" key "Street Dice"

0AF2: pos_x = read_float_from_ini_file "cleo\Busy Pedestrians.ini" section "Mr Whoopee" key "Ped Position Offset X"
0AF2: pos_y = read_float_from_ini_file "cleo\Busy Pedestrians.ini" section "Mr Whoopee" key "Ped Position Offset Y"
0AF2: pos_z = read_float_from_ini_file "cleo\Busy Pedestrians.ini" section "Mr Whoopee" key "Ped Position Offset Z"


while true
wait pause

    if
        player.Defined(0)
    then
    
        if
            not $ACTIVE_INTERIOR == 0
        then
            continue
        end

            // video news
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                if and
                    1@ > 7
                    1@ < 20
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -1946.5513 705.178 46.5625 radius 120.0
                    then
                        1@ = -1946.5513
                        2@ = 705.178
                        3@ = 46.5625
                        4@ = 204.1646
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -1510.6588 1027.1808 7.1875 radius 120.0
                    then
                        1@ = -1510.6588
                        2@ = 1027.1808
                        3@ = 7.1875
                        4@ = 358.929
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2831.1047 1319.1183 7.1016 radius 120.0
                    then
                        1@ = -2831.1047
                        2@ = 1319.1183
                        3@ = 7.1016
                        4@ = 322.8718
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -1786.4573 824.1693 24.8907 radius 120.0
                    then
                        1@ = -1786.4573
                        2@ = 824.1693
                        3@ = 24.8907
                        4@ = 340.7322
                    end

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2021.452 -971.9499 32.1719 radius 120.0
                    then
                        1@ = -2021.452
                        2@ = -971.9499
                        3@ = 32.1719
                        4@ = 13.4757
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 693.6903 1212.4789 12.982 radius 120.0
                    then
                        1@ = 693.6903
                        2@ = 1212.4789
                        3@ = 12.982
                        4@ = 58.7768
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2033.1752 1504.9546 10.8203 radius 120.0
                    then
                        1@ = 2033.1752
                        2@ = 1504.9546
                        3@ = 10.8203
                        4@ = 359.9795
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2352.9922 2324.3169 8.1406 radius 120.0
                    then
                        1@ = 2352.9922
                        2@ = 2324.3169
                        3@ = 8.1406
                        4@ = 70.1668
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1280.9069 -1372.8188 13.3146 radius 120.0
                    then
                        1@ = 1280.9069
                        2@ = -1372.8188
                        3@ = 13.3146
                        4@ = 6.8729
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 376.7464 -2039.9004 7.8301 radius 120.0
                    then
                        1@ = 376.7464
                        2@ = -2039.9004
                        3@ = 7.8301
                        4@ = 313.7391
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 999.4218 -1133.5848 23.8281 radius 120.0
                    then
                        1@ = 999.4218
                        2@ = -1133.5848
                        3@ = 23.8281
                        4@ = 270.0287
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1322.5848 -1725.6381 13.5469 radius 120.0
                    then
                        1@ = 1322.5848
                        2@ = -1725.6381
                        3@ = 13.5469
                        4@ = 301.0257
                    end


                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 50.0
                    then
                        0AAA: 0@ = get_script_struct_named "VHSQA"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "Video News.qa" 1@ 2@ 3@ 4@ render_camvhs render_microvhs chance_video_news
                            wait 2000
                        end
                    end
                end
            end
            
            // video news 2
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                if and
                    1@ > 7
                    1@ < 20
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2028.9814 -91.353 35.3203 radius 120.0
                    then
                        1@ = -2028.9814
                        2@ = -91.353
                        3@ = 35.3203
                        4@ = 58.7764
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2654.9055 364.9782 4.3659 radius 120.0
                    then
                        1@ = -2654.9055
                        2@ = 364.9782
                        3@ = 4.3659
                        4@ = 172.9642
                    end

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -1903.2212 1161.0369 45.4784 radius 120.0
                    then
                        1@ = -1903.2212
                        2@ = 1161.0369
                        3@ = 45.4784
                        4@ = 103.8971
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1458.3621 -1632.8573 14.0393 radius 120.0
                    then
                        1@ = 1458.3621
                        2@ = -1632.8573
                        3@ = 14.0393
                        4@ = 255.9511
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1103.3589 -1488.3645 22.769 radius 120.0
                    then
                        1@ = 1103.3589
                        2@ = -1488.3645
                        3@ = 22.769
                        4@ = 315.9317
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1080.3082 -1837.9823 13.5698 radius 120.0
                    then
                        1@ = 1080.3082
                        2@ = -1837.9823
                        3@ = 13.5698
                        4@ = 282.2951
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2613.9138 1824.4391 10.8203 radius 120.0
                    then
                        1@ = 2613.9138
                        2@ = 1824.4391
                        3@ = 10.8203
                        4@ = 269.9417
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1095.4357 1629.9893 12.296 radius 120.0
                    then
                        1@ = 1095.4357 
                        2@ = 1629.9893
                        3@ = 12.296
                        4@ = 192.0777
                    end


                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 40.0
                    then
                        0AAA: 0@ = get_script_struct_named "VHSQA2"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "Video News 2.qa" 1@ 2@ 3@ 4@ render_camvhs render_microvhs chance_video_news
                            wait 2000
                        end
                    end
                end
            end
            
            wait pause
            
            // arm
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                if and
                    1@ > 9
                    1@ < 18
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2779.062 -1966.9189 13.5469 radius 120.0
                    then
                        1@ = 2779.062 
                        2@ = -1966.9189
                        3@ = 13.5469
                        4@ = 270.0983
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2759.894 -1926.8804 13.5394 radius 120.0
                    then
                        1@ = 2759.894
                        2@ = -1926.8804
                        3@ = 13.5394
                        4@ = 88.7405
                    end

                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 35.0
                    then
                        0AAA: 0@ = get_script_struct_named "ARMWQA"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "ArrnWrest.qa" 1@ 2@ 3@ 4@ chance_arm
                            wait 2000
                        end
                    end
                end
            end
            
            wait pause
            
            // Pool
            if
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                0D59: get_current_weather_to 2@
                if and
                    1@ > 9
                    1@ < 18
                    not 2@ == 8
                    not 2@ == 16
                then

                    if or
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1102.3478 -675.7031 113.6484 radius 100.0
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2694.1628 915.5661 67.7188 radius 100.0
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1419.1479 -620.0723 92.1831 radius 100.0
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 195.328 -1238.0704 76.5034 radius 100.0
                    then
                        if and
                            not locate_char_distance_to_coordinates $player_actor pos 1102.3478 -675.7031 113.6484 radius 40.0
                            not locate_char_distance_to_coordinates $player_actor pos -2694.1628 915.5661 67.7188 radius 40.0
                            not locate_char_distance_to_coordinates $player_actor pos 1419.1479 -620.0723 92.1831 radius 40.0
                            not locate_char_distance_to_coordinates $player_actor pos 195.328 -1238.0704 76.5034 radius 40.0
                        then
                            0AAA: 0@ = get_script_struct_named "POOLQA"
                            if
                                0@ == 0
                            then
                                if 0EEA: locate_char_distance_to_coordinates $player_actor pos 1102.3478 -675.7031 113.6484 radius 100.0
                                then 1@ = 1
                                end
                                if 0EEA: locate_char_distance_to_coordinates $player_actor pos -2694.1628 915.5661 67.7188 radius 100.0
                                then 1@ = 2
                                end
                                if 0EEA: locate_char_distance_to_coordinates $player_actor pos 1419.1479 -620.0723 92.1831 radius 100.0
                                then 1@ = 3
                                end
                                if 0EEA: locate_char_distance_to_coordinates $player_actor pos 195.328 -1238.0704 76.5034 radius 100.0
                                then 1@ = 4
                                end
                                0A92: stream_custom_script "PoolQa.qa" 1@ chance_pool
                                wait 2000
                            end
                        end
                    end
                end
            end
            
             // whoopee
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                0D59: get_current_weather_to 2@
                if and
                    not 2@ == 8
                    not 2@ == 16
                    1@ > 9
                    1@ < 17
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 999.5447 -1825.1621 13.752 radius 120.0
                    then
                        1@ = 999.5447
                        2@ = -1825.1621
                        3@ = 13.752
                        4@ = 167.2332
                    end

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 382.3738 -1900.2257 7.8359 radius 120.0
                    then
                        1@ = 382.3738
                        2@ =  -1900.2257
                        3@ = 7.8359
                        4@ = 358.9718
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 413.2383 -1816.7312 5.5469 radius 120.0
                    then
                        1@ = 413.2383
                        2@ = -1816.7312
                        3@ = 5.546942
                        4@ = 181.3664
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2873.1414 425.973 4.9783 radius 120.0
                    then
                        1@ = -2873.1414
                        2@ =  425.973
                        3@ = 4.9783
                        4@ = 267.3646
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1750.4758 2726.4021 10.8359 radius 120.0
                    then
                        1@ = 1750.4758
                        2@ = 2726.4021
                        3@ = 10.8359
                        4@ = 96.7297
                    end
                    
                    

                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 50.0
                    then
                        0AAA: 0@ = get_script_struct_named "WhoopQa"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "Mr Whoope.qa" 1@ 2@ 3@ 4@ pos_x pos_y pos_z render_ice
                            wait 2000
                        end
                    end
                end
            end

            wait pause

            // boombox
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                0D59: get_current_weather_to 2@
                if and
                    not 2@ == 8
                    not 2@ == 16
                    1@ >= 7
                    1@ < 16
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 449.218 -1875.0103 2.9697 radius 80.0
                    then
                        1@ = 449.218
                        2@ = -1875.0103
                        3@ = 2.9697
                        4@ = 232.0176
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 509.6866 -1819.9821 5.6796 radius 80.0
                    then
                        1@ = 509.6866 
                        2@ = -1819.9821
                        3@ = 5.6796
                        4@ = 132.9903
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 359.6731 -2035.0588 7.8359 radius 80.0
                    then
                        1@ = 359.6731 
                        2@ = -2035.0588
                        3@ = 7.8359
                        4@ = 269.7862
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 947.1461 -1847.7399 11.139 radius 80.0
                    then
                        1@ = 947.1461 
                        2@ = -1847.7399
                        3@ = 11.139
                        4@ = 183.4503
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1846.5437 -2028.9846 13.5469 radius 80.0
                    then
                        1@ = 1846.5437
                        2@ = -2028.9846
                        3@ = 13.5469
                        4@ = 184.8486
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1730.0267 -2143.738 13.5518 radius 80.0
                    then
                        1@ = 1730.0267
                        2@ = -2143.738
                        3@ = 13.5518
                        4@ = 181.4487
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 182.1297 -1228.6136 78.375 radius 80.0
                    then
                        1@ = 182.1297
                        2@ = -1228.6136
                        3@ = 78.375
                        4@ = 302.2748
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1435.4768 -619.3615 92.9706 radius 80.0
                    then
                        1@ = 1435.4768 
                        2@ = -619.3615
                        3@ = 92.9706
                        4@ = 93.2562
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2642.2932 952.9828 71.9532 radius 80.0
                    then
                        1@ = -2642.2932
                        2@ = 952.9828
                        3@ = 71.9532
                        4@ = 1.7503
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1428.7926 343.6725 18.8417 radius 80.0
                    then
                        1@ = 1428.7926 
                        2@ = 343.6725
                        3@ = 18.8417
                        4@ = 68.1414
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2444.2664 2513.4822 15.2681 radius 80.0
                    then
                        1@ = -2444.2664
                        2@ = 2513.4822
                        3@ = 15.2681
                        4@ = 272.1
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 789.7252 376.5507 21.2006 radius 80.0
                    then
                        1@ = 789.7252
                        2@ = 376.5507
                        3@ = 21.2006
                        4@ = 334.1408
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 276.7607 -1774.0917 4.2713 radius 80.0
                    then
                        1@ = 277.8975
                        2@ = -1773.6013
                        3@ = 4.2713
                        4@ = 186.2542
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1888.5447 -1985.241 13.5469 radius 80.0
                    then
                        1@ = 1888.5447
                        2@ = -1985.241
                        3@ = 13.5469
                        4@ = 96.1701
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1918.0795 -1415.7042 13.5703 radius 80.0
                    then
                        1@ = 1918.0795
                        2@ = -1415.7042
                        3@ = 13.5703
                        4@ = 11.5723
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -257.6402 2580.3806 63.5703 radius 80.0
                    then
                        1@ = -257.6402
                        2@ = 2580.3806
                        3@ = 63.5703
                        4@ = 356.5437
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1418.4479 2790.0986 10.8203 radius 80.0
                    then
                        1@ = 1418.4479
                        2@ = 2790.0986
                        3@ = 10.8203
                        4@ = 92.5814
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2225.074 690.1788 11.4604 radius 80.0
                    then
                        1@ = 2225.074 
                        2@ = 690.1788
                        3@ = 11.4604
                        4@ = 359.3872
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 182.8989 -111.2236 1.5391 radius 80.0
                    then
                        1@ = 182.8989
                        2@ = -111.2236
                        3@ = 1.5391
                        4@ = 181.8355
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2385.137 -586.0589 132.1172 radius 80.0
                    then
                        1@ = -2385.137 
                        2@ = -586.0589
                        3@ = 132.1172
                        4@ = 252.9977
                    end

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2137.0786 -1572.4299 14.2794 radius 80.0
                    then
                        1@ = 2137.0786 
                        2@ = -1572.4299
                        3@ = 14.2794
                        4@ = 131.2669
                    end

                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 40.0
                    then
                        0AAA: 0@ = get_script_struct_named "BMBQA"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "BoomboxQ.qa" 1@ 2@ 3@ 4@ chance_boom
                            wait 2000
                        end
                    end
                end
            end
            
            wait pause
            
            
            // RC
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
                $Zero_Total_Passed_Missions == 3
            then
                0E40: get_current_hour 1@
                0D59: get_current_weather_to 2@
                if and
                    not 2@ == 8
                    not 2@ == 16
                    1@ > 10
                    1@ < 21
                then
                    if and
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2292.2447 181.4637 35.3056 radius 100.0
                        not locate_char_distance_to_coordinates $player_actor pos -2292.2447 181.4637 35.3056 radius 40.0
                    then
                        0AAA: 0@ = get_script_struct_named "RCZRQA"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "RC game.qa" render_rc chance_rc
                            wait 2000
                        end
                    end
                end
            end
            
            // sport
                if and
                    $ACTIVE_INTERIOR == 0
                    $ONMISSION == 0
                    887A:   not gang_war_in_progress
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2134.1011 -1575.167 14.3157 radius 100.0 // LS
                    then
                        1@ = 2134.1011
                        2@ = -1575.167
                        3@ = 14.3157
                        4@ = 158.3472
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2163.0186 -1435.3917 25.539 radius 100.0 // LS
                    then
                        1@ = 2163.0186 
                        2@ = -1435.3917
                        3@ = 25.539
                        4@ = 182.8967
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2103.9861 -1162.0352 25.5938 radius 100.0 // LS
                    then
                        1@ = 2103.9861
                        2@ = -1162.0352
                        3@ = 25.5938
                        4@ = 90.4833
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2480.5588 -1427.2819 28.8437 radius 100.0 // LS
                    then
                        1@ = 2480.5588 
                        2@ = -1427.2819
                        3@ = 28.8437
                        4@ = 180.0392
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2780.3782 -1312.5 37.0742 radius 100.0 // LS
                    then
                        1@ = 2780.3782 
                        2@ = -1312.8629
                        3@ = 37.0742
                        4@ = 90.8471
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1876.6769 -1894.012 15.0336 radius 100.0 // LS
                    then
                        1@ = 1876.6769 
                        2@ = -1894.012
                        3@ = 15.0336
                        4@ = 358.749
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2237.584 -1870.3052 14.239 radius 100.0 // LS
                    then
                        1@ = 2237.584
                        2@ = -1870.3052
                        3@ = 14.239
                        4@ = 178.4472
                    end

                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 35.0
                    then
                        0AAA: 0@ = get_script_struct_named "GSPRTQ"
                        if
                            0@ == 0
                        then
                            08F1: get_zone_at 1@ 2@ 3@ nameB_to 7@s // 8-byte string
                            076D: get_zone 7@s gang 0 density_to 6@
                            if not 6@ == 0
                            then 5@ = 7
                            end
                            076D: get_zone 7@s gang 1 density_to 6@
                            if not 6@ == 0
                            then 5@ = 8
                            end
                            076D: get_zone 7@s gang 2 density_to 6@
                            if not 6@ == 0
                            then 5@ = 9
                            end
                            if or
                                5@ == 7
                                5@ == 8
                                5@ == 9
                            then
                                0A92: stream_custom_script "Sport Gang.qa" 1@ 2@ 3@ 4@ 5@
                                wait 2000
                            end
                        end
                    end
                end

            
            wait pause

            // for sale
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                if and
                    1@ > 9
                    1@ < 16
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2474.5303 1329.6346 12.231 radius 100.0
                    then
                        1@ = -2474.5303
                        2@ = 1329.6346
                        3@ = 12.231
                        4@ = 119.8535
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2660.7173 910.9799 79.6612 radius 100.0
                    then
                        1@ = -2660.7173
                        2@ = 910.9799
                        3@ = 79.6612
                        4@ = 9.0774
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2717.396 1.1518 4.3359 radius 100.0
                    then
                        1@ = -2717.396
                        2@ = 1.1518
                        3@ = 4.3359
                        4@ = 79.5548
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2200.7 -2497.8435 30.6244 radius 100.0
                    then
                        1@ = -2200.7
                        2@ = -2497.8435
                        3@ = 30.6244
                        4@ = 153.0191
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1745.0594 -2101.9302 13.5469 radius 100.0
                    then
                        1@ = 1745.0594
                        2@ = -2101.9302
                        3@ = 13.5469
                        4@ = 24.4776
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2071.0144 -1726.8171 13.5547 radius 100.0
                    then
                        1@ = 2071.0144 
                        2@ = -1726.8171
                        3@ = 13.5547
                        4@ = 52.7997
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 685.7334 -1597.6388 14.0881 radius 100.0
                    then
                        1@ = 685.7334 
                        2@ = -1597.6388
                        3@ = 14.0881
                        4@ = 155.0804
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2452.8335 29.9185 26.5058 radius 100.0
                    then
                        1@ = 2452.8335 
                        2@ = 29.9185
                        3@ = 26.5058
                        4@ = 92.2565
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2226.832 698.0055 11.1659 radius 100.0
                    then
                        1@ = 2226.832 
                        2@ = 698.0055
                        3@ = 11.1659
                        4@ = 208.8647
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -3.8359 1076.5752 19.8874 radius 100.0
                    then
                        1@ = -3.8359
                        2@ = 1076.5752
                        3@ = 19.8874
                        4@ = 250.5385
                    end


                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 40.0
                    then
                        0AAA: 0@ = get_script_struct_named "FORSLQA"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "For Sale Qa.qa" 1@ 2@ 3@ 4@ render_hammer render_fors
                            wait 2000
                        end
                    end
                end
            end

            wait pause

            // telescope
            0D59: get_current_weather_to 2@
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
                not 2@ == 8
                not 2@ == 16
            then
                0E40: get_current_hour 1@
                if or
                    1@ >= 22
                    1@ < 6
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2509.8401 -566.6721 131.4749 radius 100.0
                    then
                        1@ = -2509.8401
                        2@ = -566.6721
                        3@ = 131.4749
                        4@ = 54.4994
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2337.0415 -1575.4597 483.5146 radius 100.0
                    then
                        1@ = -2337.0415
                        2@ = -1575.4597
                        3@ = 483.5146
                        4@ = 12.329
                    end

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2922.9009 1109.1882 26.9369 radius 100.0
                    then
                        1@ = -2922.9009
                        2@ = 1109.1882
                        3@ = 26.9369
                        4@ = 57.1361
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -795.7064 2446.3838 157.0177 radius 100.0
                    then
                        1@ = -795.7064 
                        2@ = 2446.3838
                        3@ = 157.0177
                        4@ = 28.3558
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1135.7494 -1994.9484 69.0078 radius 100.0
                    then
                        1@ = 1134.2987
                        2@ = -1995.6381
                        3@ = 69.0078
                        4@ = 38.226
                    end


                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 40.0
                    then
                        0AAA: 0@ = get_script_struct_named "TLSCOPQ"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "TlScopeQ.qa" 1@ 2@ 3@ 4@ render_telscop
                            wait 2000
                        end
                    end
                end
            end

            // date kiss
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                if and
                    1@ > 6
                    1@ < 23
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1947.0249 -1224.4513 19.9392 radius 100.0
                    then
                        1@ = 1947.0249 
                        2@ = -1224.4513
                        3@ = 19.9392
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2002.5983 -1171.1876 20.6203 radius 100.0
                    then
                        1@ = 2002.5983
                        2@ = -1171.1876
                        3@ = 20.6203
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2047.5364 -1220.9519 23.2978 radius 100.0
                    then
                        1@ = 2047.5364
                        2@ = -1220.9519
                        3@ = 23.2978
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1880.2065 -1157.5005 23.9483 radius 100.0
                    then
                        1@ = 1880.2065
                        2@ = -1157.5005
                        3@ = 23.9483
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1111.9993 -1467.9666 15.7969 radius 100.0
                    then
                        1@ = 1111.9993
                        2@ = -1467.9666
                        3@ = 15.7969
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1128.3726 -1537.4186 22.7568 radius 100.0
                    then
                        1@ = 1128.3726
                        2@ = -1537.4186
                        3@ = 22.7568
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2717.5168 364.3563 4.4078 radius 100.0
                    then
                        1@ = -2717.5168 
                        2@ = 364.3563
                        3@ = 4.4078
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2676.6797 386.89 4.3672 radius 100.0
                    then
                        1@ = -2676.6797
                        2@ = 386.89
                        3@ = 4.3672
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -1987.9911 877.2722 45.2031 radius 100.0
                    then
                        1@ = -1987.9911
                        2@ = 877.2722
                        3@ = 45.2031
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -1937.7219 890.6719 38.5078 radius 100.0
                    then
                        1@ = -1937.7219
                        2@ = 890.6719
                        3@ = 38.5078
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -1604.7928 798.3862 6.8203 radius 100.0
                    then
                        1@ = -1604.7928
                        2@ = 798.3862
                        3@ = 6.8203
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1200.3589 -2068.6802 69.0078 radius 100.0
                    then
                        1@ = 1200.3589
                        2@ = -2068.6802
                        3@ = 69.0078
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1133.5099 -2025.0521 69.0006 radius 100.0
                    then
                        1@ = 1133.5099 
                        2@ = -2025.0521
                        3@ = 69.0006
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -1955.7156 -738.9637 35.8909 radius 100.0
                    then
                        1@ = -1955.7156 
                        2@ = -738.9637
                        3@ = 35.8909
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2514.9939 2037.0332 10.8203 radius 100.0
                    then
                        1@ = 2514.9939
                        2@ = 2037.0332
                        3@ = 10.8203
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1483.3192 -1699.2026 14.0469 radius 100.0
                    then
                        1@ = 1483.3192
                        2@ = -1699.2026
                        3@ = 14.0469
                    end


                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 40.0
                    then
                        0AAA: 0@ = get_script_struct_named "KISSPKQ"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "Date Kiss.qa" 1@ 2@ 3@
                            wait 2000
                        end
                    end
                end
            end
            
            // glass
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                if and
                    1@ > 10
                    1@ < 18
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2314.8035 -56.426 35.3203 radius 100.0
                    then
                        1@ = -2314.8035 
                        2@ = -56.426
                        3@ = 35.3203
                        4@ = 276.2911
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2428.1587 1892.14 6.0156 radius 100.0
                    then
                        1@ = 2428.1587
                        2@ = 1892.14
                        3@ = 6.0156
                        4@ = 111.2126
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 1270.5298 -1267.912 13.5348 radius 100.0
                    then
                        1@ = 1270.5298
                        2@ = -1267.912
                        3@ = 13.5348
                        4@ = 283.3917
                    end


                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 40.0
                    then
                        0AAA: 0@ = get_script_struct_named "GLSCRQA"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "Glass Crash.qa" 1@ 2@ 3@ 4@
                            wait 2000
                        end
                    end
                end
            end
            
            // drunk man
            if and
                $ACTIVE_INTERIOR == 0
                $ONMISSION == 0
            then
                0E40: get_current_hour 1@
                if or
                    1@ >= 21
                    1@ < 6
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2555.165 194.5416 6.2571 radius 100.0
                    then
                        1@ = -2555.165
                        2@ = 194.5416
                        3@ = 6.2571
                        4@ = 283.4382
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2324.4492 -1646.1276 14.8271 radius 100.0
                    then
                        1@ = 2324.4492 
                        2@ = -1646.1276
                        3@ = 14.8271
                        4@ = 305.975
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 690.9706 -469.3533 16.5363 radius 100.0
                    then
                        1@ = 687.3398
                        2@ = -476.0033
                        3@ = 16.3359
                        4@ = 0.497
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -80.8669 1383.7014 10.0823 radius 100.0
                    then
                        1@ = -80.8669
                        2@ = 1383.7014
                        3@ = 10.0823
                        4@ = 337.4435
                    end
                    
                     if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2358.6025 -1356.9155 24.0145 radius 100.0
                    then
                        1@ = 2358.6025
                        2@ = -1356.9155
                        3@ = 24.0145
                        4@ = 294.5649
                    end


                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 40.0
                    then
                        0AAA: 0@ = get_script_struct_named "DRNKQA"
                        if
                            0@ == 0
                        then
                            0A92: stream_custom_script "Drunk Man.qa" 1@ 2@ 3@ 4@
                            wait 2000
                        end
                    end
                end
            end
            
            wait pause

            // dice game
                0E40: get_current_hour 1@
                if and
                    $ACTIVE_INTERIOR == 0
                    $ONMISSION == 0
                    887A:   not gang_war_in_progress
                    1@ >= 7
                    1@ <= 18
                then
                    1@ = 0.0
                    2@ = 0.0
                    3@ = 0.0

                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2271.1328 -1694.8339 13.6584 radius 100.0 // LS
                    then
                        1@ = 2271.1328
                        2@ = -1694.8339
                        3@ = 13.6584
                        4@ = 270.6165
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2094.125 -1361.4189 23.9844 radius 100.0 // LS
                    then
                        1@ = 2094.125
                        2@ = -1361.4189
                        3@ = 23.9844
                        4@ = 117.115
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2247.3369 -1102.8628 41.6016 radius 100.0 // LS
                    then
                        1@ = 2247.3369
                        2@ = -1102.8628
                        3@ = 41.6016
                        4@ = 242.2115
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos 2149.5557 -1208.0947 23.918 radius 100.0 // LS
                    then
                        1@ = 2149.5557
                        2@ = -1208.0947
                        3@ = 23.918
                        4@ = 271.642
                    end
                    
                    if
                        0EEA: locate_char_distance_to_coordinates $player_actor pos -2302.8782 -139.8627 35.3203 radius 100.0 // LS
                    then
                        1@ = -2302.8782
                        2@ = -139.8627
                        3@ = 35.3203
                        4@ = 353.364
                    end


                    if and
                        not 1@ == 0.0
                        not 2@ == 0.0
                        not 3@ == 0.0
                        not locate_char_distance_to_coordinates $player_actor pos 1@ 2@ 3@ radius 40.0
                    then
                        0AAA: 0@ = get_script_struct_named "DICGMQA"
                        if
                            0@ == 0
                        then
                            08F1: get_zone_at 1@ 2@ 3@ nameB_to 7@s // 8-byte string
                            076D: get_zone 7@s gang 0 density_to 6@
                            if not 6@ == 0
                            then 5@ = 7
                            end
                            076D: get_zone 7@s gang 1 density_to 6@
                            if not 6@ == 0
                            then 5@ = 8
                            end
                            076D: get_zone 7@s gang 2 density_to 6@
                            if not 6@ == 0
                            then 5@ = 9
                            end
                            076D: get_zone 7@s gang 3 density_to 6@
                            if not 6@ == 0
                            then 5@ = 10
                            end

                            if or
                                5@ == 7
                                5@ == 8
                                5@ == 9
                                5@ == 10
                            then
                                0A92: stream_custom_script "Street Dice.qa" 1@ 2@ 3@ 4@ 5@ chance_dice
                                wait 2000
                            end
                        end
                    end
                end

    end
end